# == Schema Information
#
# Table name: sales_firm_details
#
#  id                  :integer          not null, primary key
#  legal_person        :string(255)
#  register_money      :float(24)
#  register_money_type :integer
#  business_type       :string(255)
#  register_time       :datetime
#  business_area       :string(2000)
#  notes               :string(2000)
#  firm_id             :integer
#  created_at          :datetime         not null
#  updated_at          :datetime         not null
#

class Sales::FirmDetail < ApplicationRecord

  REGISTER_MONEY_TYPE = {rmb: 1, us: 2}


  belongs_to :firm, :class_name=>'Sales::Firm', foreign_key: 'firm_id'

  extend Enumerize
  enumerize :register_money_type, in: REGISTER_MONEY_TYPE,  predicates: {prefix: true}, scope: true

  def register_money_info
    return '' if register_money.blank?
    "#{register_money}(#{register_money_type_text})"
  end
end
